home *** CD-ROM | disk | FTP | other *** search
/ Technotools / Technotools (Chestnut CD-ROM)(1993).ISO / lang_oth / tm480 / tmexam.exe / BROWSE.TSK < prev    next >
Text File  |  1991-09-10  |  14KB  |  681 lines

  1. ; Task details after endtask... 
  2. go 1INIT
  3. 1READY
  4.  
  5. dir filespec
  6. if found
  7.   go 1FILEGET
  8. 1FILEGOT
  9. else
  10.   move '1NODEFSET' to cue
  11.   insert no_files
  12.   go 1OPTION131
  13. 1NODEFSET
  14.   move '1NODEFSET2' to cue
  15.   goto 1FILEGET
  16. 1NODEFSET2
  17. fi
  18. move true to init
  19. until forever
  20.   move '1PREFILLED' to preback
  21.   go 1PREFILL
  22. 1PREFILLED
  23.   move true to outer_menu
  24.   clear newlist
  25.   menu 1,'FILELIST',dl
  26.   option 1,1,20
  27.     move display to dold
  28.     trim dold
  29.     if not skip
  30.       move hilite to main_choice
  31.       cursor 2 17 normal 4
  32.       cursor 21 17 normal 6
  33.       put 'MENU2_HELP' nowait
  34.     else
  35.       clear bbdisp
  36.     fi
  37.     clear skip
  38.     move ac to choice
  39.     move 0ff00h to bbmask
  40.     clear outer_menu
  41.     menu 2,'ACTIONS_SELECT',cmds
  42.     option 2,1,10
  43.       move '2RET1TO10' to cue
  44.       go 2OPS1TO10
  45. 2RET1TO10
  46.       dir dold
  47.       if not found
  48.         move '1CLEARED' to cue
  49.         go 1CLEARENT
  50. 1CLEARED
  51.         cursor row 2 att2 14 normal
  52.         go 101RETURN
  53.       fi
  54.       if not autoreturn
  55.         clear bbdisp
  56.         return
  57.       fi
  58.       clear bbdisp
  59.       put 'FILELIST_HELP' nowait
  60.       exitm
  61.     option 2,31
  62.       if popop ne 0
  63.         popscreen popid
  64.         popdown popop
  65.         cursor 23 70 attn 1 'Any key' 1 normal
  66.         inkey char
  67.         popdown popid
  68.         popfree popid
  69.       fi
  70.       move hilite to choice
  71.       clear bbdisp
  72.       return
  73.     option 1,33 ;F3=R-O
  74.     option 1,34 ;F4=R/W
  75.       move display to dold
  76.       trim dold
  77.     option 2,33 ;F3=R-O
  78.     option 2,34 ;F4=R/W
  79.       if choice = 34
  80.         attrib set rw dold
  81.       else
  82.         attrib set ro dold
  83.       fi
  84.       move hilite to choice
  85.       clear bbdisp
  86.       return
  87.     option 1,35 ;F5=Delete 
  88.       move display to dold
  89.       trim dold
  90.     option 2,35 ;F5=Delete 
  91.       cursor 16 18 normal cel attn
  92.       find banned sw dold 
  93.       if not found
  94.         ask sure 'Erase ' dold ', are you sure? (Type Y/N then <return>)'
  95.       else
  96.         clear sure
  97.       fi
  98.       if sure
  99.         erase dold
  100.         dir dold
  101.         if found
  102.           cursor 16 18 normal cel attn 'Sorry: unable to erase ' dold ' (perhaps protected!)' normal
  103.           move hilite to choice
  104.           inkey char
  105.           if char = zero
  106.             inkey
  107.           fi 
  108.           cursor 16 18 normal cel 
  109.           return
  110.         else
  111.           move '1CLEARED2' to cue
  112.           go 1CLEARENT
  113. 1CLEARED2
  114.           cursor row 2 att2 14 normal
  115.         fi
  116.       else
  117.         cursor 16 18 normal cel
  118.         move hilite to choice
  119.         return
  120.       fi
  121.       cursor 16 18 normal cel
  122.       if not newlist
  123.         go 101RETURN
  124.       fi
  125.       exitm
  126.     option 2,36 ;F6=Copy 
  127.     option 2,37 ;F7=Move
  128.       move hilite to ac
  129.       go 1F6F7
  130.     option 1,36 ;F6=Copy 
  131.     option 1,37 ;F7=Move
  132.       move hilite to main_choice
  133.       move display to dold
  134.       trim dold
  135. 1F6F7
  136.       fieldfill dest
  137.       put 'WHERE_TO' noclear ul 
  138.       get dest
  139.       cursor 23 0 normal cel 
  140.       if anyfk
  141.         move hilite to choice
  142.         clear bbdisp
  143.         put 'RE_USE' nowait
  144.         return 
  145.       fi
  146.       put 'RE_USE' nowait
  147.       combine 'copy ' dold 1 dest into cmd
  148.       move '2RETCMD' to cue 
  149.       go 1RUNCMD
  150. 2RETCMD
  151.       if choice = 37
  152.         go 37CHOICE
  153. 37RETURN
  154.       fi
  155.       move hilite to ac
  156.       if not newlist
  157.         go 2POPFREE
  158.       fi
  159.       exitm
  160.     option 2,30
  161.       clear bbdisp
  162.       put 'FILELIST_HELP' nowait
  163.       exitm
  164.     option 2,32
  165.       go 101RETURN
  166.     endm 2
  167.     move main_choice to choice
  168.     move true to bbdisp
  169.     exitm
  170.   option 1,31
  171.     move '1RETURN131' to cue
  172.     go 1OPTION131
  173. 1RETURN131
  174.     move "1RESUME" to cue
  175.     GOTO 1FILEGET
  176. 1RESUME
  177.     exitm
  178.   option 1,30
  179.     append 12 to filespec
  180.     save savename dest path filespec cmds autoreturn
  181.     if resp ne 0
  182.       displayln 'BROWSE: Unable to store defaults in ' savename
  183.     else
  184.       save
  185.     fi
  186.     stop
  187.   option 1,43
  188.     if twenty_count ne 0
  189.       decrement twenty_count
  190.     fi
  191.     exitm
  192.   option 1,44
  193.     if last_file >= 20
  194.       increment twenty_count
  195.     fi
  196.     exitm
  197.   endm 1
  198. fi
  199. stop
  200.  
  201. 37CHOICE
  202. ;wait 'in 37choice'
  203. if elevel = 0
  204.   find banned sw dold 
  205.   if not found
  206.     erase dold 
  207.   fi
  208.   dir dold
  209.   if found
  210.     cursor 16 18 normal cel attn 'Sorry - unable to erase ' dold ' (perhaps protected!)' normal
  211.     inkey char
  212.     if char = zero
  213.       inkey
  214.     fi 
  215.     cursor 16 18 normal cel 
  216.   else
  217.     move '1CLEARED3' to cue
  218.     go 1CLEARENT
  219. 1CLEARED3
  220. ;wait 'at 1cleared - was popdown popid here!'
  221. ;    popdown popid
  222. ;    popfree popid
  223.     cursor row 2 att2 14 normal 
  224.     if not newlist
  225.       go 101RETURN
  226.       clear bbdisp
  227.     fi
  228.   fi
  229. fi
  230. goback 37RETURN
  231.  
  232. 101RETURN
  233. ;wait 'in 101RETURN'
  234. if not outer_menu
  235.   increment main_choice
  236.   if main_choice > 20
  237.     move 1 to main_choice
  238.   fi
  239. fi
  240. move main_choice to i
  241. decrement i
  242. clear live_entry 
  243. until live_entry
  244.   if entry i of dl sw ' '
  245.     increment i
  246.     if i = 20
  247.       clear i
  248.     fi
  249.   else
  250.     move true to live_entry
  251.   fi
  252. fi 
  253. increment i
  254. move i to main_choice 
  255. move main_choice to choice 
  256. if outer_menu
  257.   clear bbdisp
  258.   return
  259. else
  260.   move hilite to ac
  261.   move true to skip
  262.   return 101
  263. fi
  264.  
  265. 1POPFREE
  266. ;wait 'in popfree'
  267. popdown popid
  268. popfree popid
  269. 2POPFREE
  270. move hilite to choice
  271. clear bbdisp
  272. return
  273.  
  274.  
  275. 1CLEARENT
  276. ;wait 'in 1clearent'
  277. find fns sw dold
  278. if found
  279.   move spaces to entry row of fns
  280. fi
  281. find dl sw dold
  282. if found
  283.   move spaces to entry row of dl
  284.   decrement live_entries
  285.   add 2 to row
  286. fi
  287. if live_entries = 0
  288.   clear init
  289.   move cue to savecue2
  290.   move '1REFRESH' to cue
  291.   go 1OPTION131
  292. 1REFRESH
  293.   move '2FILEGOT' to cue
  294.   go 1FILEGET
  295. 2FILEGOT
  296.   move 1 to main_choice
  297.   move savecue2 to cue
  298. fi
  299. goback cue
  300.  
  301. 1FILEGET
  302. if path ne opath or filespec ne ofilespec
  303.   display 'Reading filelist.'
  304.   dir filespec
  305.   clear fns twenty_count count last_file
  306.   until not found or count = 512
  307.     increment last_file
  308.     setscan display 30
  309.     clear fn
  310.     scan fn
  311.     if fn ct null
  312.       sizevar fn fcol
  313.     fi
  314.     move fn to entry count of fns
  315.     if count < 20
  316.       move fn to entry count of dl
  317.     fi
  318.     display '.'
  319.     dir
  320.   fi count
  321.   move true to bbdisp
  322.   move true to newlist
  323.   move found to extras
  324. fi
  325. display cls
  326. put 'FILELIST_HELP' nowait
  327. move path to opath
  328. move filespec to ofilespec
  329. trim opath ofilespec
  330. goback cue
  331.  
  332. 1OPTION131
  333. move 255 to resp
  334. clear found
  335. until resp = 0 and found
  336.   move autoreturn to ar
  337.   fieldfill path filespec cmds ar
  338.   display cls
  339.   put 'PATH_SPEC'
  340.   if funkey = 10
  341.     if init
  342.       put 'FILELIST_HELP' sw 2 nowait 
  343.       return
  344.     else
  345.       stop
  346.     fi
  347.   fi
  348.   get path filespec
  349.   clear count
  350.   until count = 10
  351.     get entry count of cmds
  352.   fi count
  353.   get autoreturn
  354.   trim path filespec
  355.   upper path
  356.   user path
  357.   if path sw '\'
  358.   else
  359.     select path
  360.   fi
  361.   dir filespec
  362.   if not found
  363.     insert no_files
  364.   fi
  365. fi
  366. GOBACK cue 
  367.  
  368. 2OPS1TO10
  369. move choice to ac
  370. move display to cmd
  371. trim cmd
  372. append 1 dold to cmd
  373. 1RUNCMD
  374. popscreen popid ;save current screen...
  375. display normal cls
  376. clear found
  377. upper cmd
  378. if cmd sw 'SCR '
  379.   if dold ct '.MAC' or dold ct '.TSK'
  380.     find banned sw dold
  381.   else 
  382.     move true to found
  383.   fi
  384. fi
  385. if found
  386.   displayln 'Not appropriate to run SCR on this file'
  387.   move 255 to elevel
  388. else
  389.   run cmd
  390. fi
  391. if elevel ne 0
  392.   cursor 23 70 attn 1 'Any key' 1 normal
  393.   inkey char
  394. fi 
  395. if popop ne 0   ;popop saves op
  396.   popfree popop ;if already used; clear first
  397. fi
  398. popscreen popop ;saved app. output
  399. ;wait 'about to popdown popid'
  400. popdown popid   ;restore main display
  401. popfree popid   ;give back the ram
  402. goback cue
  403.  
  404. 1PREFILL
  405. move twenty_count to first_entry
  406. multiply first_entry by 20
  407. add 20 to first_entry giving last_entry
  408. move first_entry to i
  409. clear count live_entries dl
  410. until count = 20
  411.   if entry i of fns ne spaces
  412.     move entry i of fns to entry count of dl
  413.     increment live_entries
  414.   fi
  415.   increment i
  416. fi count
  417. if twenty_count ne 0
  418.   move 0df04h to bbmask       ;esc, f1, and PgUp
  419.   cursor 2 17 attn 'PgUp' normal
  420. else
  421.   move 0df00h to bbmask       ;esc and f1 only
  422.   cursor 2 17 normal 4
  423. fi
  424. if last_entry < last_file     ;more to display
  425.   add 02h to bbmask             ;PgDown
  426.   cursor 21 17 attn 'PgDown' normal
  427. else
  428.   cursor 21 17 normal 6 
  429. fi
  430. goback PREBACK
  431.  
  432. 1INIT
  433. define rw,0
  434. define ro,1
  435. define main_choice,1
  436. vconst cls,11
  437. vconst cel,55
  438. vconst normal,5
  439. vconst att2,71
  440. vconst attn,79
  441. logical autoreturn
  442. logical extras
  443. logical forever
  444. logical init
  445. logical live_entry
  446. logical newlist
  447. logical outer_menu
  448. logical skip
  449. logical sure
  450.  
  451. hexvar null,00
  452.  
  453. int ac
  454. int count
  455. int first_entry
  456. int last_file
  457. int live_entries
  458. int i
  459. int j
  460. int last_entry
  461. int offset
  462. int popid
  463. int popop
  464. int twenty_count
  465.  
  466. var ar,1
  467. var banned,12,occurs 2,
  468. 'BROWSE.TSK  '
  469. 'OVERVIEW.MAC'
  470.  
  471. var char,1
  472. var cmd,50
  473. var cmds,9,occurs 10,
  474. 'list     '
  475. 'scr      '
  476. 'tm       '
  477.  
  478. var cue,10,"1FILEGOT"
  479. var dest,40
  480. var preback,10 
  481. var savecue,10
  482. var savecue2,10
  483. var dl,13,occurs 20
  484. var dold,12
  485. var fn,13,'BROWSE'
  486. var fns,13,occurs 512
  487. var filespec,12,'*.tsk'
  488. var ofilespec,12
  489. var fmpdir,30,$FMPDIR
  490. var no_files,23,'No matching files found'
  491. var nothing,1
  492. var path,50
  493. var opath,50
  494. var savename,40
  495. var formsname,40
  496.  
  497. end
  498.  
  499. if fmpdir = nothing
  500.   move '\fmp' to fmpdir
  501. fi
  502. forms logon.ovr
  503. display cls
  504. combine fmpdir '\browse.ovr' into formsname
  505. replace '\\' of formsname with '\'
  506. dir formsname
  507. if not found
  508.   insert fn fn
  509.   put "NO_FORMS"    ;logon.ovr open already!
  510.   stop
  511. fi
  512. combine fmpdir '\browse.tm' into savename 
  513. replace '\\' of savename with '\'
  514. dir savename
  515. if found
  516.   restore savename dest path filespec cmds autoreturn
  517.   if resp ne 0
  518.     displayln 'BROWSE: Error during restore from ' savename
  519.     wait
  520.     stop
  521.   else
  522.     restore 
  523.   fi
  524. fi
  525. user path
  526. move true to hide
  527. enable ctrl_c
  528. forms formsname
  529. goback 1READY
  530.  
  531. endtask
  532. ; Title   : BROWSE.TSK                  Last Updated : September 6, 1991
  533. ; Author  : Steve Johnson - FmP.        Version      : 1.10
  534. ; Purpose : example of the use of Taskmaster DIR command.
  535. ; Notes   : This is a Shareware Taskmaster task, if it were a PROTEAN task 
  536. ;         : or a Professional Taskmaster task it would be simpler to 
  537. ;         : code and to follow because it could use subtasks... 
  538. ; Version 1.10
  539. ;         : Now uses built-in ATTRIB command.
  540.  
  541. @video
  542. @head left,'Browse Task'
  543. @head right,'Copyright (c) FmP 1991'
  544. @head centre,'Filelist menu'
  545. @nf filelist_help
  546. @col char,cyan,blue
  547. @dim
  548. @banner
  549. @col char,yellow,black
  550. @window line 4,column 55,depth10,width0
  551. @col char,yellow,blue
  552. @window line 5,column 20,depth10,width 37,pattern 176
  553. @bright
  554. @window line 4,column 18,depth10,width 37,pattern 177
  555.  
  556.   Select a file and press 
  557.  
  558.   Press F1 to change filelist  or
  559.   the list of applications   that
  560.   appear on the next menu.  (Also
  561.   saves details for next run).
  562.  
  563.   Press <esc> to quit
  564. @use 'F3=Protect F4=UnProtect F5=Delete F6=Copy F7=Move'
  565. @end
  566. @nf re_use
  567. @overlay
  568. @col char,yellow,blue
  569. @bright
  570. @use 'F3=Protect F4=UnProtect F5=Delete F6=Copy F7=Move'
  571. @end
  572.  
  573. @nf filelist
  574. @col char,yellow,blue
  575. @dim
  576. @window line 2,column2,depth1,width1
  577. @bbmenu cyan,blue
  578. @repeat x20
  579. {012345678901 }
  580. @bright
  581. @end
  582. @nf path_spec
  583. @col page,cyan,blue
  584. @dim
  585. @head centre,'Defaults Edit'
  586. @banner
  587. @acceptfk f10
  588. @path
  589. @str min1
  590. @str min1
  591. @str
  592. @str
  593. @str
  594. @str
  595. @str
  596. @str
  597. @str
  598. @str
  599. @str
  600. @log
  601. @bright
  602.  
  603.   Please supply defaults for Browse:
  604.  
  605.    Path [                                                  ] (must exist)
  606. @dim
  607.    (This is the directory where BROWSE will search)
  608.  
  609. @bright
  610.    Filespec [            ] e.g. t*.t?k {                       }
  611. @dim
  612.    (This is the filespec BROWSE will use for that search)
  613.  
  614. @bright
  615.    These are the commands that appear on the second menu:
  616. @repeat x10
  617.    [        ]
  618.  
  619.    Autoreturn after
  620.    command? [ ]
  621. @colour char,yellow,blue
  622. @dim
  623. @window line13,column22,depth11,width57,pattern176
  624. @bright
  625. @window line12,column20,depth11,width57,pattern177
  626.  
  627.   Use the TAB and BACKTAB (or ) and HOME keys to move
  628.   between fields
  629.  
  630.   Use INS and DEL keys to edit at cursor position
  631.  
  632.   Hold CTRL and Press T to clear from cursor to end of
  633.   current field
  634.  
  635.   Press F10 to abandon any changes or  to save them
  636. @colour char,cyan,blue
  637. @end
  638. @nf actions_select
  639. @col char,cyan,blue
  640. @dim
  641. @head centre,'Actions menu'
  642. @banner
  643. @window line 4,column 18,depth 1,width1
  644. @bbmenu cyan,blue
  645. @repeat x10
  646. {01234567 }
  647. @end
  648. @nf menu2_help
  649. @colour char,cyan,black
  650. @window line 4,column 18,depth 11,width0
  651. @col char,yellow,blue
  652. @window line 5,column 32,depth9,width 37,pattern 176
  653. @bright
  654. @window line 4,column 30,depth9,width 37,pattern 177
  655.  
  656.   Select a command and press 
  657.  
  658.   Press <ESC> to quit this menu
  659.  
  660.   Press F1 to see command screen
  661.  
  662.   Press F2 to select next file
  663. @end
  664. @nf clear_menu_2
  665. @dim
  666. @col char,yellow,black
  667. @window line 4,column 20,depth8,width 39
  668. @window line 2,column 28,depth 10,width10
  669. @end
  670. @nf where_to
  671. @acceptfk f10
  672. @path
  673. @col char,yellow,blue
  674. @bright
  675. @win line23,column0,depth1,width0
  676. Destination directory: [                                        ] (F10=Abandon)
  677. @end
  678. @eof
  679.  
  680. 
  681.